home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
MPW_TOOL
/
TOOLS
/
TOOLS_WI
/
BYACC__
/
NULLABLE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-11-19
|
787b
|
55 lines
#include <stdio.h>
#include "defs.h"
#include "gram.h"
#include "new.h"
set_nullable()
{
register int i, icon;
register int done, flag;
nullable = NEW2(nsyms, char);
done = 0;
while ( ! done)
{
done = 1;
for (i = 0; i < nitems; i++)
{
flag = 1;
icon = ritem[i];
while (icon > 0)
{
if ( ! nullable[icon]) flag = 0;
i++;
icon = ritem[i];
}
if (flag)
{
icon = rlhs[-icon];
if ( ! nullable[icon])
{
nullable[icon] = 1;
done = 0;
}
}
}
}
#ifdef DEBUG
for (i = 0; i < nsyms; i++)
{
if (nullable[i])
printf("%s is nullable\n", symbol_name[i]);
else
printf("%s is not nullable\n", symbol_name[i]);
}
#endif
}
free_nullable()
{
FREE(nullable);
}